﻿using Infrastructure.WebApi;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace Web.Controllers
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class PassiveController : ControllerBase
    {
        public IPassiveService _service { get; set; }
        public PassiveController(IPassiveService service)
        {
            _service = service;
        }
        [HttpGet]
        public async Task<Page<Passive>> Get([FromQuery] PassiveListRequest request)
        {
            return await _service.Get(request);
        }
        [HttpPost]
        public Task<bool> Add([FromBody] PassiveForm request)
        {
            return _service.Add(request);
        }
        [HttpPut]
        public async Task<bool> Update(PassiveForm request)
        {
            return await _service.Update(request);
        }
        [HttpDelete]
        public Task Delete([FromQuery]IdRequest request)
        {
            return _service.Delete(request);
        }
        [HttpGet, AllowAnonymous]
        public Task<string> Value([FromQuery] PassiveCallback request)
        {
            return _service.Value(request);
        }
        [HttpGet, AllowAnonymous]
        public Task<string> Callback([FromQuery]PassiveCallback request)
        {
            return _service.Callback(request);
        }
    }
}